package io.renren.modules.sys.controller;

import io.renren.common.utils.R;
import io.renren.modules.sys.form.MyRegisterForm;
import io.renren.modules.sys.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 注册相关
 */
@RestController
public class SysRegisterController {


    @Autowired
    private SysUserService sysUserService;
    @PostMapping("/sys/register")
    public R register(@RequestBody MyRegisterForm form){
        System.out.println(form);
        System.out.println("请求到我了");
        boolean isRegister = sysUserService.register(form);
        if (isRegister){
            return R.ok("注册成功");
        }
        return R.error("注册失败");
    }
}
